<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>

<!-- header -->
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <div class="header" id="doubleClick">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack()" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>赛事详情</h6>
        </div>
        <div class="head-action">
            <a href="javascript:void(0);" tapmode onclick="openModel()" class="action-btn"></a>
        </div>
    </div>
</div>
<!-- header end -->

<div class="detail-section" style="padding-top: 1.5rem;">
    <div class="detail-title mb25">
        <h6 class="mb10" id="title"></h6>
        <div class="detail-title-flex">
            <div class="title-user">
                <p class="c-666" id="name"></p>
                <dl class="badge-list ml5" id="badgeList">
                    <!--<dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>-->
                    <!--<dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>-->
                    <!--<dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>-->
                    <!--<dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>-->
                    <!--<dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>-->
                </dl>
                <span class="time ml15" id="time"></span>
            </div>
            <div class="detail-hot" id="hot">0</div>
        </div>
    </div>
    <div class="detail">
        <div id="content"></div>
        <!--<div class="detail-img" id="fm_pics"></div>-->

        <div class="indexContent">
            <div class="index-news">
                <ul id="voteDetail">

                </ul>
            </div>
        </div>
    </div>
    <div class="detail-label" id="label">

    </div>
    <!--<div class="detail-label">#公益广告#</div>-->
    <div class="share-view">
        <div class="share-section">
            分享到
            <ul>
                <li class="icon icon-wx" tapmode onclick="shareWx()"></li>
                <li class="icon icon-wxq" tapmode onclick="shareWxq()"></li>
                <li class="icon icon-qq" tapmode onclick="shareQq()"></li>
                <li class="icon icon-qzone" tapmode onclick="shareQzone()"></li>
                <li class="icon icon-wb" tapmode onclick="shareWb()"></li>
            </ul>
        </div>
    </div>
</div>

<div class="comment-section">
    <div class="comment-kinds">
        <ul>
            <li tapmode onclick="tabComment()" class="on"><span>全部评论</span></li>
        </ul>
        <div class="screen-btn" tapmode onclick="screen(this)">按热度</div>
    </div>
    <div class="comment-area">
        <div class="comment-list area">
            <ul id="commentHtml">

            </ul>
            <div class="comment-input">
                <div class="input-box">
                    <input type="text" id="inputContent" readonly data-pid="" placeholder="写评论...">
                    <!--<button class="send-btn" tapmode onclick="comment_add()">确定</button>-->
                </div>
                <div class="comment-count">
                    <div class="count-li collect" id="collect" tapmode onclick="collect(this)">0</div>
                    <div class="count-li love" id="love" tapmode onclick="clickFabulous('',6,'',event)">0</div>
                    <div class="count-li msg" id="msg" tapmode onclick="toAllList()">0</div>
                </div>
            </div>


        </div>
    </div>
</div>

<div class="edit-model">
    <div class="edit-input">
        <div class="message-flex">
            <div class="message-box" id="message">
                <div class="message" id="article" contenteditable="true"></div>
            </div>
            <div class="message-img" style="display: none;" id="msgImg">
                <img src="" alt="">
                <span class="delete dn" tapmode onclick="removePic(this,event)"></span>
            </div>
        </div>

        <div class="But">
            <div class="but-list">
                <a href="javascript:void(0);" tapmode onclick="upload()" class="imgBut"></a>
                <a href="javascript:void(0);" tapmode onclick="showVideo()" class="videoBut"></a>
                <a href="javascript:void(0);" tapmode onclick="toAiteList()" class="aiTeBut"></a>
            </div>
            <span class="submit" tapmode onclick="comment_add()">确定</span>
        </div>
    </div>
</div>

<!-- 右上角操作 -->
<div class="action-model model" tapmode onclick="closeModel()">
    <div class="action-view" tapmode onclick="stopModel(event)">
        <h6 class="shareTitle">分享</h6>
        <a href="javascript:void(0);" tapmode onclick="closeModel(event)" class="model-close"></a>
        <div class="model-detail">
            <ul>
                <li tapmode onclick="shareWx(event)" class="threeShare">
                    <div class="share-icon icon1"></div>
                    <p>微信</p>
                </li>
                <li tapmode onclick="shareWxq(event)" class="threeShare">
                    <div class="share-icon icon2"></div>
                    <p>朋友圈</p>
                </li>
                <li tapmode onclick="shareQq(event)" class="threeShare">
                    <div class="share-icon icon3"></div>
                    <p>QQ</p>
                </li>
                <li tapmode onclick="shareQzone(event)" class="threeShare">
                    <div class="share-icon icon4"></div>
                    <p>QQ空间</p>
                </li>
                <li tapmode onclick="shareWb(event)" class="threeShare">
                    <div class="share-icon icon5"></div>
                    <p>微博</p>
                </li>
                <li tapmode class="copy" onclick="copyLink()">
                    <div class="share-icon icon-copy"></div>
                    <p>复制链接</p>
                </li>
                <!--<li tapmode onclick="reportBtn(event)">
                    <div class="share-icon icon-report"></div>
                    <p>举报</p>
                </li>-->
            </ul>
        </div>
        <!--<div class="shade-user">-->
        <!--<a href="javascript:void(0);" class="shade-btn"><span>屏蔽此人</span></a>-->
        <!--</div>-->
    </div>
</div>
<!-- 右上角操作 end -->

<!--图片浏览-->
<div class="photoViewer">
    <div class="swiper-container photoViewer-swiper">
        <ul class="swiper-wrapper" id="swiperPic">
            <!--<li class="swiper-slide"><img src="../../image/banner01.png" alt=""></li>-->
        </ul>
        <div class="photoViewer-bottom">
            <div onclick="closeView()" class="closeViewer"></div>
            <div class="swiper-pagination"></div>
            <div onclick="downloadPic(event)" class="download"></div>
        </div>
    </div>
</div>

<!--评论通用-->
<div class="photoViewerCommon">
    <div class="swiper-container photoViewer-common">
        <ul class="swiper-wrapper">
            <!--<li class="swiper-slide"><img src="../../image/banner01.png" alt=""></li>-->
            <li class="swiper-slide" onclick="closeViewCommon()"><img onclick="showViewCommon(event)" id="currentPic" class="swiper-lazy" src="" alt=""><div class="swiper-lazy-preloader"></div></li>
        </ul>
        <div class="photoViewer-bottom">
            <div onclick="closeViewCommon()" class="closeViewer"></div>
            <div class="swiper-pagination"></div>
            <div onclick="downloadPicCommon(event)" class="download"></div>
        </div>
    </div>
</div>

</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<!--<link rel="stylesheet" type="text/css" href="../../css/zy.media.min.css"/>-->
<!--<script type="text/javascript" src="../../script/zy.media.min.js"></script>-->
<script type="text/javascript" src="../../script/clipboard.min.js"></script>

<link rel="stylesheet" type="text/css" href="../../script/videoJs/video-js.min.css"/>
<script type="text/javascript" src="../../script/videoJs/video.min.js"></script>
<script type="text/javascript" src="../../script/detailSwiper.js"></script>
<script type="text/javascript" src="../../script/comment.js"></script>

<style type="text/css">
    .index-news>ul>li{
        padding-top: 0.25rem!important;
        background: #f5f5f5;
        padding-bottom: 0;
        border-radius: 5px;
    }

    .index-news .video-detail .news-title{
        padding: 0 .2rem;
    }
    .voteView .choose li{
        padding: 0.25rem 0 0.25rem 0.86rem!important;
    }
    .voteView .voteResult li{
        align-items: center;
    }
</style>
<script type="text/javascript">
    var war_id = '';//赛事id
    var member_id = '';//用户id
    var stype = 1;//类型：1显示评论 2显示喜欢
    var sort = 1;//排序：1时间排序 2热度排序
    var page = 1;
    var pullUp = true;
    var shareTitle = '';//分享title
    var shareInfo = '发现精彩大学生活，更多内容，尽在大学情报局～（分享自大学情报局 App）';//分享info
    var shareImg = 'widget://icon/logo.png';//分享图片

    var video_id = 0;
    var msgImg_id = 0;

    apiready = function () {

        /*$api.fixStatusBar($api.dom('#header'));
        api.setStatusBarStyle({
            style: 'light', //设置APP状态栏字体色
            color: '#000', //设置APP状态栏背景色
        });*/
        keybackListener()
        setFixStatusBar(); //设置状态栏
        pop.loading()
        war_id = api.pageParam.war_id;

        //上拉加载
        pullUpLoading(function () {
            if (pullUp == true) {
                getWarDetail()
            }
        });

        /*//下拉刷新
        dropDownRefresh(function () {
            stype = 1;
            hot = 1;
            page = 1;
            getWarDetail()
        });*/

        getWarDetail()

        SystemCheckVersion()

        api.addEventListener({
            name: 'aite'
        }, function(ret, err) {
            console.log(JSON.stringify(ret.value));
            var mid = ret.value.id;
            var mname = ret.value.name;
            var mUrl = '../activity/person_index';
            var m_id = {member_id: mid}
            var word = '<span style="display: inline; color: #ff7777;" class="aite" data-id="'+mid+'" onclick=\'commonUrl("'+mUrl+'",'+jsonChange(m_id)+')\'>@'+mname+'</span>　';
            // $("#article").append(word);
            checkSystemType(function () {
                $("#article").append(word);
            },function () {
                _insertimg(word)
            });
        });

    }


    function toAllList() {
        //type: 1新闻，2帖子，3活动贴，4赛事，5战况，6投票，7广场评星
        getAllList(5,war_id)
    }


    //二级评论获取评论目标
    var _input = $("#inputContent");
    var _editModel = $(".edit-model");
    var _article = $("#article");
    _input.click(function () {
        _editModel.show();
        var html = _article.html()
        _article.html('').focus();
    });

    function reply(id, name) {
        var pid = id;
        _input.attr('placeholder', '回复：' + name);
        _input.attr('data-pid', pid);
        _editModel.show();
        _article.focus();
        console.log(pid)
    }

    /*_article.blur(function () {
        if (_article.html() == '' || msgImg_id != 0) {
            _input.val('');
            _input.attr('placeholder', '写评论...');
            _input.attr('data-pid', '');
        }
    });*/


    //关闭评论框
    _editModel.on('click', function () {
        _input.val('');
        _input.attr('placeholder', '写评论...');
        _input.attr('data-pid', '');
        _editModel.hide()
    });
    //阻止事件冒泡 关闭评论框
    _editModel.on('click', '.edit-input', function (event) {
        event.stopPropagation()
        /*_article.focus();*/
    });

    //评论
    var addStatus = true;
    function comment_add() {
        var pid = '', type = 5;
        if (_input.attr('data-pid')) {
            pid = _input.attr('data-pid');
            type = 0;
        }
        var uidsArr = [];
        $("#article .aite").each(function () {
            var _this = $(this);
            var _thisId = _this.attr('data-id');
            uidsArr.push(_thisId);
        });
        var param = {
            token: $api.getStorage('token'),
            type: type,//类型：1新闻 2帖子 3活动 0回复 4赛事，5战况，6投票，7广场
            key_id: war_id,
            content: _article.html(),
            pid: pid,//当type为0的时候必须传入,二级回复，就是评论的id
            icon: msgImg_id,
            void_id: video_id,
            uids: uidsArr.toString()
        }
        if (!isDefine(param.content)&&!isDefine(param.icon)&&!isDefine(param.void_id)) {
            pop.notice('请发表你的评论内容');
            return false;
        }
        if(addStatus == false){
            return;
        }
        console.log(jsonChange(param));
        // return;
        pop.loading();
        getAjax(Interface.comment_add, param, function (res) {
            addStatus = false;

            _editModel.hide();
            _article.html('');
            _input.attr('placeholder', '写评论...');
            _input.attr('data-pid', '');

            $("#msgImg").siblings('img').attr('src','').removeAttr('data-id');
            $("#msgImg").hide();
            msgImg_id = 0;
            video_id = 0;

            pop.notice(res.msg)
            pop.close();
            setTimeout(function () {
                page = 1;
                getWarDetail()
                addStatus = true;
            }, 1500)
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
        })
        _article.blur();//失去焦点
    }


    //举报
    function reportBtn(event) {
        event.stopPropagation()
        var param = {
            type: 1,
            pid: match_id,
        }
        commonUrl('../member/jubao',param);
        closeModel()
    }


    //排序
    function screen(that) {
        var _this = $(that);
        if(_this.html() == '按热度'){
            $(".screen-btn").html('按时间')
            sort = 2;
        }else {
            $(".screen-btn").html('按热度');
            sort = 1;
        }
        page = 1;
        getWarDetail();
    }

    var videoUrl = '';

    $('#matchVideo').on('click','#video_player', function () {
        play(videoUrl)
    })

    function getVote(){

        var param = {
            token: $api.getStorage('token'),
            result_id: news_id,
            type: 2,//类型：1新闻 2赛况
        }
        getAjax(Interface.news_vote, param, function (res) {
            // console.log(jsonChange(res))
            var data = res.data;

            var html = vote_detail(data,1);

            $("#voteDetail").html(html);
            console.log(html)

        },function(error){
            // pop.notice(error.msg)
        })
    }

    //活动详情
    function getWarDetail() {

        var param = {
            token: $api.getStorage('token'),
            match_war_id: war_id,//比赛id
            type: sort,//type :1时间排序 2热度排序
            page: page,
        }
        getAjax(Interface.get_match_details, param, function (res) {
            var data = res.data;
            if (isDefine(data)) {
                var userInfo = data.member;

                $('#videoName').html(data.title);
                shareTitle = data.title;//分享title

                $("#title").html(data.title);
                $("#content").html(data.content);

                $("#content a").each(function () {
                    var _this = $(this);
                    var url = _this.attr('href');
                    _this.attr('href','javascript:void(0);');
                    _this.attr('onclick','toUrl("'+url+'")');
                })

                getPics();//获取图片
                // $("#fm_pic").attr('src', ajaxUrl + data.icon_path[0]);

                $("#time").html(data.date);
                $("#hot").html(data.news_hot);
                if (isDefine(data.news_label_name)) {
                    var labelHtml = '';
                    for (var la = 0; la < data.news_label_name.length; la++) {
                        var labelP = {"tips_id": data.news_label_name[la].id}
                        labelHtml += '<span tapmode onclick=\'commonUrl("../index/news_list",' + jsonChange(labelP) + ')\'>#' + data.news_label_name[la].title + '#</span>'
                    }
                    $("#label").html(labelHtml);
                }

                if (isDefine(data.void_ids)) {

                    checkSystemType(function () {
                        //ios
                        $('#matchVideo').html('<video style="width: 100%; height: 100%;" src="' + ajaxUrl + data.void_ids + '" poster="' + ajaxUrl + data.void_icon_path + '"></video><span class="player-icon" id="video_player"></span>')
                        videoUrl = ajaxUrl + data.void_ids

                    },function () {
                        //android
                        var videoHtml = '<video id="video"  id="video" poster="'+ ajaxUrl + data.void_icon_path +'">' +
                            '                <source src="'+ ajaxUrl + data.void_ids+'" type="video/mp4" />' +
                            '            </video>'
                        $('#matchVideo').html(videoHtml);
                        doZyMediaJs(1)

                    });

                }

                //分享封面图
                if(isDefine(data.void_icon_path)){
                    shareImg = ajaxUrl + data.void_icon_path;
                }


                if (data.member_id == 0) {
                    $("#badgeList").hide()
                    $("#name").hide()
                } else {
                    if(data.member_id == $api.getStorage('userInfo').id){

                        $("#name").show().html('<a href="javascript:void(0)" tapmode class="c-primary" >' + data.member_name + '</a>');

                    }else {
                        var p = {'member_id': data.member_id};
                        $("#name").show().html('<a href="javascript:void(0)" tapmode class="c-primary" onclick=\'commonUrl("../activity/person_index",' + jsonChange(p) + ')\'>' + data.member_name + '</a>');

                    }

                    if (isDefine(data.badge_path)) {
                        var imgUrls = '';
                        for (var i = 0; i < data.badge_path.length; i++) {
                            imgUrls += '<dd class="icon"><img src="' + ajaxUrl + data.badge_path[i] + '" alt=""></dd>'
                        }
                        $("#badgeList").show().html(imgUrls)

                    }
                }

                //收藏
                $("#collect").html(data.collection_number)
                if (data.collect_status == 1) {
                    $("#collect").addClass('on')
                } else {
                    $("#collect").removeClass('on')
                }


                //点赞
                $("#love").html(data.fabulous_number)
                $("#loveNum").html(data.fabulous_number)
                if (data.fabulous_status == 1) {
                    $("#love").addClass('on')
                } else {
                    $("#love").removeClass('on')
                }

                //评论量
                $("#plNum").html(data.comment_number)
                $("#msg").html(data.comment_number)

                getVote();

                var comment = data.list.comment;
                if (stype == 1 || stype == 3) {
                    var commentHtml = '';
                    if (isDefine(comment)) {
                        commentHtml = getEvaluteList(comment,war_id)
                        if (page == 1) {
                            $("#commentHtml").html(commentHtml)
                        } else {
                            $("#commentHtml").append(commentHtml)
                        }
                        page++;
                        pullUp = true;
                    } else {
                        if (page == 1) {
                            $("#commentHtml").html(noData)
                        }
                        pullUp = false;
                    }

                } else {
                    var list = data.list;
                    var listHtml = '';
                    if (isDefine(list)) {
                        for (var i = 0; i < list.length; i++) {
                            var autograph = '';
                            if (list[i].autograph == '' || list[i].autograph == 0) {
                                autograph = commonNote;
                            } else {
                                autograph = list[i].autograph
                            }

                            var listBadge = '';
                            if (isDefine(list[i].badge_path)) {
                                for (var a = 0; a < list[i].badge_path.length; a++) {
                                    listBadge += '<dd class="icon"><img src="' + ajaxUrl + list[i].badge_path[a] + '" alt=""></dd>';
                                }
                            }


                            var userHtml = '';
                            userHtml = '<div class="user-info">' +
                                '            <div class="userRelative"><div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + list[i].icon_path + ');"></div><span class="vip"></span></div>' +
                                // '            <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + list[i].icon_path + ');"></div>' +
                                '                            <div class="info">' +
                                '                                <div class="name">' +
                                '                                    <h6>' + list[i].name + '</h6>' +
                                '                                    <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + listBadge + '</dl>' +
                                '                                </div>' +
                                '                                <p class="sign-info single-ellipsis">' + autograph + '</p>' +
                                // '                                <span class="time">3分钟前</span>' +
                                '                            </div>' +
                                '                        </div>';


                            var param = {"member_id": list[i].id};
                            listHtml += '<li><div class="common-user-detail" tapmode onclick=\'commonUrl("../activity/person_index",' + jsonChange(param) + ')\'>' + userHtml + '</div></li>';

                        }
                        $("#sign_list").html(listHtml)
                    } else {
                        $("#sign_list").html(noData)
                    }


                }

            }
            pop.close();
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
        })
    }





    var imagesArr = [];
    function getPics() {
        var swiperPic = '';
        $("#content img").each(function (index) {
            var _this  = $(this);
            var _thisSrc = _this.attr('src');
            _this.attr('index',index);
            imagesArr.push(_thisSrc);
            swiperPic +='<li class="swiper-slide" onclick="closeView()"><img onclick="showView(event)" class="swiper-lazy" src="'+ _thisSrc +'" alt=""><div class="swiper-lazy-preloader"></div></li>'
        })

        $("#swiperPic").html(swiperPic);

    }


    var _modelViewer = $(".photoViewer");
    var downloadPicUrl = '';
    var PicUrlArr = [];
    var index = 0;
    $("#content").on('click','img',function () {
        var _this  = $(this);
        index = _this.attr('index');
        downloadPicUrl = _this.attr('src');
        PicUrlArr[0] = downloadPicUrl;
        photoView.slideTo(index, 0, false);//切换到第一个slide，速度为1秒
        openView()
    });

    var photoView = new Swiper('.photoViewer-swiper',{
        spaceBetween: 20,
        observer:true,
        observeParents:true,
        lazyLoading : true,
        pagination : '.swiper-pagination',
        paginationType : 'fraction',
        onSlideChangeStart: function(swiper){
            downloadPicUrl = imagesArr[swiper.activeIndex];
            PicUrlArr[0] = downloadPicUrl;
        }
    })


    function openView(){
        _modelViewer.show();
    }
    function closeView(){
        _modelViewer.hide();
    }
    function showView(event){
        event.stopPropagation();
        var UIPhotoViewer = api.require('UIPhotoViewer');
        UIPhotoViewer.open({
            images: PicUrlArr,
            activeIndex: 0,
            bgColor: '#000'
        }, function(ret, err) {
            if (ret) {
                if(ret.eventType =='click'){

                    var UIPhotoViewer = api.require('UIPhotoViewer');
                    UIPhotoViewer.close();
                }
            } else {
            }
        });

    }

    function downloadPic(event) {
        event.stopPropagation();
        var timestamp = new Date().getTime();
        var pathArr = downloadPicUrl.split('.');
        var imgtypes = pathArr[pathArr.length - 1];
        api.download({
            url: downloadPicUrl,
            savePath: 'fs://test'+timestamp+'.'+imgtypes,
            report: true,
            cache: true,
            allowResume: true,
            networkTypes:"all"
        }, function(ret, err) {
            console.log(JSON.stringify(ret))
            if(ret.state==1){
                api.saveMediaToAlbum({
                    path: ret.savePath
                }, function(res, errs) {
                    console.log(JSON.stringify(res))
                    console.log(JSON.stringify(errs))
                    if(res.status ==true){
                        api.toast({
                            msg:'图片已保存到相册'
                        })
                    }else{
                        api.toast({
                            msg:'图片保存到相册失败'
                        })
                    }
                });
            }

        });

    }


    //添加收藏、取消收藏
    var toast = true
    function collect(that) {
        var _this = $(that);
        var pid = war_id;
        var type = 6;
        if(toast){
            if(_this.hasClass('on')){
                collection_cancel(type,pid,function (res) {
                    pop.notice('取消收藏')
                    _this.removeClass('on').html(parseInt(_this.html())-1)
                    pop.close()
                })
            }else {
                collection(type,pid,function (res) {
                    pop.notice('收藏成功')
                    _this.addClass('on').html(parseInt(_this.html())+1)
                    pop.close()
                })
            }
            toast = false;
            setTimeout(function () {
                toast = true;
            },1000)
        }

    }


    //点赞或者取消点赞 类型type：1新闻 2帖子 3活动 4评论
    function clickFabulous(f_stype, type, pid,event) {
        event.stopPropagation()
        //活动点赞
        if (type == 6) {
            pid = war_id;
            if ($('#love').hasClass('on')) {
                f_stype = 2
            } else {
                f_stype = 1
            }
        }

        fabulous(f_stype, type, pid, function (res) {
            if (f_stype == 1) {
                pop.notice('点赞成功')
            } else {
                pop.notice('取消点赞')
            }
            setTimeout(function () {
                page = 1;
                getWarDetail()
            }, 500)
        })
    }




    var _model = $(".model");

    //开启弹窗
    function openModel() {
        _model.addClass('showModel');
        setTimeout(function () {
            _model.find('.action-view').addClass('showView');
        }, 10)
    }

    //阻止事件冒泡
    function stopModel(event) {
        event.stopPropagation();
    }

    //关闭弹窗
    function closeModel(event) {
        if (event) {
            event.stopPropagation();
        }
        _model.find('.action-view').removeClass('showView');
        setTimeout(function () {
            _model.removeClass('showModel');
        }, 500)
    }

    function copyLink() {
        var text = ajaxUrl + '/api/share/news?type=3&id='+war_id;
        copy(text);
    }


    //scene:session（会话）timeline（朋友圈）favorite（收藏）
    //title:标题
    //thumb 图标
    //contentUrl 分享的地址

    //微信好友分享
    function shareWx() {
        var p = {
            apiKey: '',
            scene: 'session',
            title: shareTitle,
            thumb: 'widget://icon/logo.png',
            description:shareInfo,
            contentUrl: ajaxUrl + '/api/share/news?type=3&id='+war_id,
        };
        wxpyqFX(p);
    }

    //朋友圈
    function shareWxq() {
        var p = {
            apiKey: '',
            scene: 'timeline',
            title: shareTitle,
            thumb: 'widget://icon/logo22.png',
            description:shareInfo,
            contentUrl: ajaxUrl + '/api/share/news?type=3&id='+war_id,
        };
        wxpyqFX(p);
    }

    //qq好友
    function shareQq() {
        var p = {
            url: ajaxUrl + '/api/share/news?type=3&id='+war_id,
            title: shareTitle,
            description: shareInfo,
            imgUrl: shareImg,
            type: 'QFriend'
        }
        qqfx(p);
    }

    //qq空间
    function shareQzone() {
        var p = {
            url: ajaxUrl + '/api/share/news?type=3&id='+war_id,
            title: shareTitle,
            description: shareInfo,
            imgUrl: shareImg,
            type: 'QZone'
        }
        qqfx(p);
    }

    //微博
    function shareWb() {
        var p = {
            apiKey: '',
            scene: 'session',
            title: shareTitle,
            description: shareInfo,
            thumb: 'widget://icon/logo22.png',
            contentUrl: ajaxUrl + '/api/share/news?type=3&id='+war_id,
        };
        weibo_authorize(p);
    }



</script>
